package org.ricks.common.conf;

import org.ricks.log.Level;
import org.ricks.utils.StrUtil;


@ConfProperties(value = "log.properties",prefix = "log.")
public class LogConfig {

    private static String level = "info";

    private static String example;

//    private static String format = "{date} [{level}] \t{message}";
    private static String format = "{date} [{level}] {class}.{method}:{thread}  {message}";

    private static String provider;

    private static boolean escapingEnabled;

    private static String exception = "";

    private static boolean writingthread = true;

    private static String file = "";

    private static String encoding;

    private static boolean append;

    private static String policies = "daily: 00:00";

    private static String latest;

    private static int backups = -1;

    public static Level getLevel() {
        return Level.valueOf(StrUtil.swapCase(level));
    }

    public static void setLevel(String level) {
        LogConfig.level = level;
    }

    public static String getExample() {
        return example;
    }

    public static void setExample(String example) {
        LogConfig.example = example;
    }

    public static String getFormat() {
        return format;
    }

    public static void setFormat(String format) {
        LogConfig.format = format;
    }

    public static String getProvider() {
        return provider;
    }

    public static void setProvider(String provider) {
        LogConfig.provider = provider;
    }

    public static boolean isEscapingEnabled() {
        return escapingEnabled;
    }

    public static void setEscapingEnabled(boolean escapingEnabled) {
        LogConfig.escapingEnabled = escapingEnabled;
    }

    public static String getException() {
        return exception;
    }

    public static void setException(String exception) {
        LogConfig.exception = exception;
    }

    public static boolean isWritingthread() {
        return writingthread;
    }

    public static void setWritingthread(boolean writingthread) {
        LogConfig.writingthread = writingthread;
    }

    public static String getFile() {
        return file;
    }

    public static void setFile(String file) {
        LogConfig.file = file;
    }

    public static String getEncoding() {
        return encoding;
    }

    public static void setEncoding(String encoding) {
        LogConfig.encoding = encoding;
    }

    public static boolean isAppend() {
        return append;
    }

    public static void setAppend(boolean append) {
        LogConfig.append = append;
    }

    public static String getPolicies() {
        return policies;
    }

    public static void setPolicies(String policies) {
        LogConfig.policies = policies;
    }

    public static String getLatest() {
        return latest;
    }

    public static void setLatest(String latest) {
        LogConfig.latest = latest;
    }

    public static int getBackups() {
        return backups;
    }

    public static void setBackups(int backups) {
        LogConfig.backups = backups;
    }
}
